CC=@CC@
CXX=@CXX@

SRCHOME=../../src

JSON_INC = $(shell pkg-config --cflags json-c)
JSON_LIB = $(shell pkg-config --libs json-c)

CFLAGS=-g -fPIC -DPIC -I$(SRCHOME)/include $(JSON_INC) @CFLAGS@
LIBNDPI=$(SRCHOME)/lib/libndpi.a
LDFLAGS=$(LIBNDPI) @PCAP_LIB@ @LIBS@ @ADDITIONAL_LIBS@ $(JSON_LIB) -lpthread -lm @LDFLAGS@
HEADERS=$(SRCHOME)/include/ndpi_api.h $(SRCHOME)/include/ndpi_typedefs.h $(SRCHOME)/include/ndpi_protocol_ids.h
OBJS=unit
PREFIX?=@prefix@

all: unit

EXECUTABLE_SOURCES := unit.c
COMMON_SOURCES := $(filter-out $(EXECUTABLE_SOURCES),$(wildcard *.c ))

unit: $(LIBNDPI) unit.o
	$(CC) $(CFLAGS) unit.o -o $@ $(LDFLAGS)

%.o: %.c $(HEADERS) Makefile
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	/bin/rm -f *.o unit
	/bin/rm -f .*.o.cmd .*.o.d
	/bin/rm -rf build

install:
	echo ""

distdir:


distclean: clean
	/bin/rm -f Makefile
